package com.bt.lms.ui.page.sys.style.action.btn;

import com.bt.lms.ui.page.sys.style.BtnStyle;
import javafx.beans.property.BooleanProperty;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;

/**
 * 分页标签鼠标移入事件
 */
public class PagingBtnMouseAction implements EventHandler<MouseEvent> {

    /**
     * 标签
     */
    private final Button button;

    /**
     * 构建事件
     *
     * @param button 按钮
     */
    public PagingBtnMouseAction(Button button) {
        this.button = button;
    }

    /**
     * 事件执行
     *
     * @param event the event which occurred
     */
    @Override
    public void handle(MouseEvent event) {

        //背景色
        Color backgroundRgb = Color.rgb(221,221,221);
        BackgroundFill backgroundFill = new BackgroundFill(backgroundRgb, BtnStyle.PAGING_CORNER_RADII, null);
        Background background = new Background(backgroundFill);
        button.setBackground(background);

        //边框
        Color borderRgb = Color.rgb(170,170,170);
        BorderStroke borderStroke = new BorderStroke(borderRgb,
                BorderStrokeStyle.SOLID, BtnStyle.PAGING_CORNER_RADII, new BorderWidths(1));
        Border border = new Border(borderStroke);
        button.setBorder(border);

        //下划线
        BooleanProperty booleanProperty = button.underlineProperty();
        booleanProperty.set(true);

    }
}
